package com.lm.scau.framedemos;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.GridView;
import android.widget.RelativeLayout;

import com.lm.scau.framedemos.Activity.PicassoActivity;
import com.lm.scau.framedemos.Activity.VolleyActivity;
import com.lm.scau.framedemos.Adapter.LMGridViewAdapter;
import com.lm.scau.framedemos.CViews.LineActivity;
import com.lm.scau.framedemos.Dagger2.DaggerActivity;
import com.lm.scau.framedemos.Entity.Entity;
import com.lm.scau.framedemos.Views.LMGridView;
import com.lm.scau.framedemos.Views.LMTitleBar;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

/**
 * Function:
 * auth：liming on 2016/5/30 15:35
 * mail：liming@wxchina.com
 */
public class GridActivity extends BaseActivity {
    private LMGridView mGridView;
    private LMGridViewAdapter mGridAdapter;
    private List<String> items;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_grid_view);
        mGridView = (LMGridView) findViewById(R.id.gridview);
        mTitleBar = (LMTitleBar) findViewById(R.id.titlebar);
        items = new ArrayList<>();
        String[] itemInfos = getIntent().getExtras().getString("itemInfo").split(",");
        mTitleBar.setTitle(getIntent().getExtras().getString("title"));
        Collections.addAll(items, itemInfos);
        mGridAdapter = new LMGridViewAdapter(this, items, null);
        mGridView.setAdapter(mGridAdapter);
        mGridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                String target = items.get(position);
                Intent intent = null;
                switch(target){
                    case "DiskLruCache":
                    break;
                    case "ImageLoader":
                        break;
                    case "Picasso":
                        intent = new Intent(GridActivity.this, PicassoActivity.class);
                        break;
                    case "Fresco":
                        break;
                    case "Glide":
                        break;
                    case "Android AsyncHTTP":
                        break;
                    case "AndroidAsync":
                        break;
                    case "OKhttp":
                        break;
                    case "Retrofit":
                        break;
                    case "Volley":
                        intent = new Intent(GridActivity.this, VolleyActivity.class);
                        break;
                    case "Gjson":
                        break;
                    case "Jackson":
                        break;
                    case "FastJson":
                        break;
                    case "HtmlPaser":
                        break;
                    case "Jsoup":
                        break;
                    case "OrmLite":
                        break;
                    case "Sugar":
                        break;
                    case "GreenDao":
                        break;
                    case "ActiveAndroid":
                        break;
                    case "SQLBrite":
                        break;
                    case "Realm":
                        break;
                    case "ButterKnife":
                        break;
                    case "Dagger2":
                        intent = new Intent(GridActivity.this, DaggerActivity.class);
                        break;
                    case "AndroidAnotations":
                        break;
                    case "RoboGuide":
                        break;
                    case "WilliamChart":
                        break;
                    case "HelloCharts":
                        break;
                    case "MPAndroidChart":
                        break;
                    case "Tape":
                        break;
                    case "AndroidPriorty Job Queue":
                        break;
                    case "EventBus":
                        break;
                    case "Otto":
                        break;
                    case "MailOtto":
                        break;
                    case "RxJava":
                        break;
                    case "RxjavaJoins":
                        break;
                    case "RxAmdroid":
                        break;
                    case "RxBingding":
                        break;
                    case "Logger":
                        break;
                    case "Hugo":
                        break;
                    case "Timber":
                        break;
                    case "Mockito":
                        break;
                    case "Stetho":
                        break;
                    case "LeakCanary":
                        break;
                    case "ACRA":
                        break;
                    case "折线图":
                        intent = new Intent(GridActivity.this, LineActivity.class);
                        break;
                    default:
                }
                if(null!=intent){
                    startActivity(intent);
                }else{
                    showToast("didn't complete !");
                }

            }
        });
    }
}
